package com.china.zhuoyue.ui.activity.estate.home.service

import android.view.View
import com.china.zhuoyue.databinding.ActivityDecorateApplyBinding
import com.china.zhuoyue.ui.base.BaseActivity
import com.china.zhuoyue.ui.dialog.TimePickerPopupExt
import com.china.zhuoyue.ui.dialog.createTimePicker
import com.china.zhuoyue.ui.ext.format
import com.china.zhuoyue.ui.ext.toastMessageLong

class DecorateApplyActivity : BaseActivity<ActivityDecorateApplyBinding>() {
    private val mBeginTimePickerPopupExt: TimePickerPopupExt by lazy {
        createTimePicker {
            vb.tvBeginTime.text = it.format()
        }
    }

    private val mEndTimePickerPopupExt: TimePickerPopupExt by lazy {
        createTimePicker {
            vb.tvEndTime.text = it.format()
        }
    }

    override fun initView() {
        bindViewClick(vb.buttonSubmit, vb.tvBeginTime, vb.tvEndTime)
    }

    override fun onClick(v: View?) {
        when (v) {
            vb.buttonSubmit -> {
                "提交成功".toastMessageLong()
                finish()
            }
            vb.tvBeginTime -> mBeginTimePickerPopupExt.show()
            vb.tvEndTime -> mEndTimePickerPopupExt.show()
        }
    }
}